package com.pheruagor.handmanager.controller {
    import com.pheruagor.handmanager.model.ApplicationProxy;
    import com.pheruagor.handmanager.model.business.Club;
    import com.pheruagor.handmanager.view.ClubCreationPopUpMediator;
    import com.pheruagor.handmanager.view.component.ClubCreationPopUp;

    import mx.managers.PopUpManager;

    import org.puremvc.as3.interfaces.INotification;
    import org.puremvc.as3.patterns.command.SimpleCommand;

    public class CloseClubCreationPopUpCommand extends SimpleCommand {
        public static const NAME:String = "closeClubCreationPopUpCommand";
        public static const EXECUTED:String = NAME + "Executed";

        override public function execute(notification:INotification):void {
            var popup:ClubCreationPopUp = ClubCreationPopUp(notification.getBody().popup);
            facade.removeMediator(ClubCreationPopUpMediator.NAME);
            PopUpManager.removePopUp(popup);

            var club:Club = Club(notification.getBody().club);
            sendNotification(EXECUTED, club);
        }
    }
}